<template>
	<view>
		
	<form @submit="formSubmit">
		<view class="content">
			<label class="lable">电炉铁水成分标准铜%:</label>
			<input placeholder="请输入" type="number"  :value="bnhjcftjssbz.cuBz" name="cuBz" class="v_input"  />
		</view>
		
		<view class="content">
			<label class="lable">电炉铁水成分标准锡%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.snBz" name="snBz"  class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">电炉铁水成分标准锰%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.mnBz" name="mnBz"  class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">铜粒铜含量%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.tlCuhl" name= "tlCuhl"  class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">铜粒铜吸收率%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.tlCuxsl" name= "tlCuxsl"  class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">锡粒锡含量%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.xlSnhl" name= "xlSnhl" class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">锡粒锡吸收率%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.xlSnxsl" name= "xlSnxsl" class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">锰铁含锰量%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.mtMnhl" name= "mtMnhl" class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">锰铁锰吸收率%:</label>
			<input placeholder="请输入" type="number" :value="bnhjcftjssbz.mtMnxsl" name= "mtMnxsl"  class="v_input"/>
		</view>

		<view style="display: flex;">
			<button form-type="submit" class="btn">保存</button>
		</view>
	</form>
		
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				bnhjcftjssbz: [],
			}
		},
		onShow:function(e){
			this.$verify.verify();
		},
		onLoad() {
			this.getBnhejcftzssbz();
		},
		methods: {
			// isFormEmpty(bzpd) {
			//     return Object.values(bzpd).some(value => value === null||" ");
			//   },
			getBnhejcftzssbz(){
				uni.request({
					url:apiUrl+'/bnhjcftzss/list',
					header:{
						'content-type':'application/json'
					},
					method:'POST',
					data: {...{},...{deptId:uni.getStorageSync("deptId"),type: 2}},
					success: (res) => {
						if(res.statusCode === 200 &&  res.data.data.length > 0)
						{
							this.bnhjcftjssbz = res.data.data[0];
						}
					}
				})
			},
			formSubmit(e) {
				let formData = e.detail.value;
				if(Object.values(formData).some(value => value === "")){
					uni.showToast({
						title: "请维护所有元素标准！",
						icon:'error',
						duration:1000
					});
					return ;
				}
					uni.request({
						url: apiUrl+'/bnhjcftzss/edit',
						data:{...this.bnhjcftjssbz,...formData, ...{deptId:uni.getStorageSync("deptId"),type: 2}},
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						method : 'POST',
						success: (res) => {
							if(res.statusCode === 200)
							{
								uni.showToast({
									title: '成功',
									icon:'success',
									duration:1000
								});
								setTimeout(() => {
									uni.redirectTo({
									    url: '/pages/index/index'
									});
								}, 1000)
							}else{
								uni.showToast({
									title: title,
									icon:'erro',
									duration:2500
								});
							}
						}
				});
			}


		}
	}
</script>

<style>
@import url("@/common/bzwh.css");

</style>
